package com.xcity.game.buff.effect;

import com.xcity.db.entity.Player;
import com.xcity.game.buff.Buff;
import com.xcity.game.buff.BuffEffector;
import com.xcity.game.common.Cause;
import com.xcity.game.task.Task;

/**
 * 自动完成日常任务
 * @author yang.li
 *
 */
public class AutoCompleteDailyTaskEffect implements BuffEffector {

	@Override
	public boolean effect(Buff buff, Player player) {
		if (!player.isOnline()) {
			return false;
		}
		if (player.getTasks().finish(Task.TYPE_DAILY, Cause.BUFF)) {
			buff.addUsedTimes(1);
			return true;
		}
		return false;
	}

	@Override
	public boolean uneffect(Buff buff, Player player) {
		return false;
	}

}
